import request from 'utils/request'

export function getRoles() {
  return request({
    url: '/roles?include=permissions',
    method: 'get'
  })
}

export function getPermissions() {
  return request({
    url: '/permissions',
    method: 'get'
  })
}

export function updateRole(id, data) {
  return request({
    url: '/roles/' + id + '?include=permissions',
    method: 'patch',
    data
  })
}

export function createRole(data) {
  return request({
    url: '/role?include=permissions',
    method: 'post',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: '/roles/' + id,
    method: 'delete'
  })
}
